<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Creating and editing templates</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>

<body>

<div role="main"><h1>Creating and editing templates</h1>
<p>Content Assist uses templates to enable you to quickly make use of commonly used code segments.  </p>
<p>To create a template:</p>

<ol>
  <li>Click <strong>Window &gt; Preferences</strong>.</li>
  <li>Expand <strong>C/C++</strong>, expand <strong>Editor</strong> and select <strong>Templates</strong>.</li>
  <li>Click <strong>New</strong>.<p><br>
  <img src="../images/code_templates_new.png" alt="Creating a new Code Template Window"><br></p>
<br>
  </li>
  <li><p>Do the following: (if required)</p>
	<ul>
  		<li>In the <strong>Name</strong> field, type a template name.</li>
  		<li>In the <strong>Context</strong> drop down list, select the context type for the new template; either  <strong>C/C++</strong> or a <strong>Comment</strong>.</li>
  		<li>In the <strong>Description</strong> field, type a description for the new template.</li>
  		<li>In the <strong>Pattern</strong> field, type the code for this template.</li>
  		<li>Click <strong>Insert Variable</strong> to add a variable from the list to the code you have entered in the <strong>Pattern</strong> field.</li>
	</ul>
 </li>
 <li>Click <strong>OK</strong>.<br>
 The new template displays in the Templates list. </li>
</ol>

<p>To edit a template:</p>

<ol>
  <li>Click <strong>Window &gt; Preferences</strong>.</li>
  <li>Expand <strong>C/C++</strong>, expand <strong>Editor</strong> and select <strong>Templates</strong>.</li>
  <li>Click <strong>Edit</strong>. The Edit Template dialog opens.<p><br>
  <img src="../images/codetemplates_example.png"  alt="Editing a Code Template"><br></p>
  <br></li>
  <li><p>Do the following:</p>
	<ul>
  		<li>In the <strong>Name</strong> field, change the template name to create a new 
        template based on the current template. </li>
  		<li>In the <strong>Context</strong> drop down list, select the context type for the new template; either  <strong>C/C++</strong> or a <strong>Comment</strong>.</li>
  		<li>In the <strong>Description</strong> field, change the description of the code 
        template to reflect your changes.</li>
  		<li>In the <strong>Pattern</strong> field, edit the code.</li>
  		<li>Click <strong>Insert Variable</strong> to add a variable from the list to the 
        code you edited in the <strong>Pattern</strong> field.</li>
	</ul>
 </li>
 <li>Click <strong>OK</strong>.</li>
</ol>

<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_content_assist.htm">Content Assist</a></p>
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="cdt_t_contentassist.htm">Using Content Assist</a><br>
<a href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21"> <br>
<a href="../reference/cdt_u_code_temp.htm">Templates page</a></p>
<p>
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >

</div></body>

</html>